package tpenchere.service;

import tpenchere.model.User;

public class SessionHolder {
	private static SessionHolder instance = null;
	
	private User loggedUser = null;
	
	private SessionHolder() {
		
	}
	
	public static SessionHolder getInstance(){
		if(instance == null) {
			instance = new SessionHolder();
		}
		return instance;
	}

	public void setLoggedUser(User loggedUser) {
		this.loggedUser = loggedUser;
	}

	public User getLoggedUser() {
		return loggedUser;
	}
	
	public Boolean isAuthenticated() {
		return this.loggedUser != null;
	}
	
	public void clearSession(){
		this.loggedUser = null;
	}
}
